<?php
    session_start();
    include("../Connect/connection.php");
	session_register("AdminID");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
        <title>Login Admin Autocar</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="description" content="Expand, contract, animate forms with jQuery wihtout leaving the page" />
        <meta name="keywords" content="expand, form, css3, jquery, animate, width, height, adapt, unobtrusive javascript"/>
		<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon"/>
        <link rel="stylesheet" type="text/css" href="../Admin/css/style.css" />
		<script src="../car/js/cufon-yui.js" type="text/javascript"></script>
		<script src="../car/js/ChunkFive_400.font.js" type="text/javascript"></script>
		<script type="text/javascript">
			Cufon.replace('h1',{ textShadow: '1px 1px #fff'});
			Cufon.replace('h2',{ textShadow: '1px 1px #fff'});
			Cufon.replace('h3',{ textShadow: '1px 1px #000'});
			Cufon.replace('.back');
		</script>
</head>
<?php
    if(isset($_REQUEST['login'])){
        $user = $_REQUEST['user'];
        $mk = $_REQUEST['pass'];
        $sqldn = mysql_query("select * from account where UserName='".$user."' and Password='".$mk."'");
        $rowdn = mysql_fetch_array($sqldn);
        $dn= mysql_num_rows($sqldn);
        $ten = $rowdn["Name"];
        if($dn > 0){
            $_SESSION["AdminID"]=$user;
			$ss = $_SESSION["AdminID"];
            echo("<script>alert('Welcome $ten, Login successful');</script>");
            echo("<script>window.location='home.php';</script>");
        }else{
			echo("<script>alert('Account wrong error !');</script>");
        	echo("<script>window.location='login.php'</script>");
        }
    }
?>
<body>
		<div class="wrapper">
			<div class="content">
				<div id="form_wrapper" class="form_wrapper">
						<form class="login active" method="post" enctype="multipart/form-data" action="">
						<h3>Login</h3>
						<div>
							<label>Username:</label>
							<input type="text" name="user" />
						</div>
						<div>
							<label>Password: </label>
							<input type="password" name="pass"/>
						</div>
						<div class="bottom">
							<input type="submit" value="Login" name="login"></input>
							<div class="clear"></div>
						</div>
					</form>
				</div>
				<div class="clear"></div>
			</div>
		</div>
</body>
</html>